import Vue from 'vue'
import Vuex from 'vuex'
import userStore from './module/userStore'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    status: 0,
    navStatus: 0,
    jquery_self: null,
    current: 1,
    myOrderCurrent: 1,
    supplierCurrent: 1,
    userGoodsCurrent: 1,
    distributionCurrent: 1,
    historyCount : 0,
    yesterdayCount : 0
  },
  mutations: {
    setHistoryCount(state,data){
      state.historyCount = data
    },
    setYesterdayCount(state,data){
      state.yesterdayCount = data
    },
    setNavStatus(state, data) {
      state.navStatus = data
    },
    setCurrent(state, data) {
      state.current = data
    },
    setUserGoodsCurrent(state, data) {
      state.userGoodsCurrent = data
    },
    setMyOrderCurrent(state, data) {
      state.myOrderCurrent = data
    },
    setSupplierCurrent(state, data) {
      state.supplierCurrent = data
    },
    setDistributionCurrent(state,data){
      state.distributionCurrent = data
    },
    init(state) {
      state.myOrderCurrent = 1;
      state.current = 1
      state.userGoodsCurrent = 1
      state.supplierCurrent = 1
      state.distributionCurrent = 1
    }
  },
  getters: {
    getCurrent: state => state.current,
    getUserGoodsCurrent: state => state.userGoodsCurrent,
    getMyOrderCurrent: state => state.myOrderCurrent,
    getSupplierCurrent: state => state.supplierCurrent,
    getDistributionCurrent : state => state.distributionCurrent,
    getHistoryCount : state => state.historyCount,
    getYesterdayCount : state => state.yesterdayCount
  },
  actions: {
  },
  modules: {
    userStore
  }
})
